import memcache
import math
from datetime import datetime
import sys

if __name__ == '__main__': 
    pref = 'zero'
    if len(sys.argv) >1:
        pref = sys.argv[1]
    mc = memcache.Client(['127.0.0.1:11211'],debug=0)
    print mc
    
    kvs={}
    for i in range(1,10000):
        key = pref + ('_%d' % i)
        kvs[key] = math.pi*i
        
    while (1):
        start_time = datetime.now()
        mc.set_multi(kvs)
        print 'set multi cost', datetime.now()-start_time    
    
    rs = mc.get_multi(kvs.keys())
    print len(rs)


